//---------------------------------------------------------------------------
#include <vcl.h>
#include <list>
#include <vector>

#include "visualizadorAbstrato.h"
#include "visualizadorTabela.h"
#include "classeTabela.h"
#include "f_Tabela.h"
//---------------------------------------------------------------------------

visualizadorTabela::visualizadorTabela(float x,float y):visualizadorAbstrato(x,y)
{
	tblTabela = new Tabela(1, 1);
};
//------------------------------------------------------------------------------
visualizadorTabela::~visualizadorTabela()
{
	delete tblTabela;
	tblTabela = NULL;
};
//------------------------------------------------------------------------------
void visualizadorTabela::desenha(TImage *area, double escalaX,double escalaY)const
{
		area->Canvas->Brush->Color = clGray;
		area->Canvas->Rectangle((getX())*escalaX,(getY())*escalaY,(getX()+44)*escalaX,(getY()+44)*escalaY);
		if (escalaX == 1)
		{
				area->Canvas->Brush->Color = clWhite;
				area->Canvas->Rectangle((getX()+2)*escalaX,(getY()+6)*escalaY,(getX()+25)*escalaX,(getY()+37)*escalaY);

				//linhas da lista
				area->Canvas->MoveTo(getX()+5,getY()+10);
				area->Canvas->LineTo(getX()+20,getY()+10);

				area->Canvas->MoveTo(getX()+5,getY()+10);
				area->Canvas->LineTo(getX()+5,getY()+26);

				area->Canvas->MoveTo(getX()+5,getY()+26);
				area->Canvas->LineTo(getX()+10,getY()+26);

				area->Canvas->MoveTo(getX()+20,getY()+10);
				area->Canvas->LineTo(getX()+20,getY()+26);

				area->Canvas->MoveTo(getX()+10,getY()+10);
				area->Canvas->LineTo(getX()+10,getY()+26);

				area->Canvas->MoveTo(getX()+15,getY()+10);
				area->Canvas->LineTo(getX()+15,getY()+26);

				area->Canvas->MoveTo(getX()+20,getY()+10);
				area->Canvas->LineTo(getX()+20,getY()+26);

				area->Canvas->MoveTo(getX()+5,getY()+13);
				area->Canvas->LineTo(getX()+20,getY()+13);

				area->Canvas->MoveTo(getX()+5,getY()+16);
				area->Canvas->LineTo(getX()+20,getY()+16);

				area->Canvas->MoveTo(getX()+5,getY()+19);
				area->Canvas->LineTo(getX()+20,getY()+19);

				area->Canvas->MoveTo(getX()+5,getY()+22);
				area->Canvas->LineTo(getX()+20,getY()+22);

				area->Canvas->MoveTo(getX()+5,getY()+26);
				area->Canvas->LineTo(getX()+20,getY()+26);

				//Bola do desenho
				area->Canvas->Brush->Color = clGray;
				//texto do desenho
				area->Canvas->Brush->Color = clWhite;
				area->Canvas->TextOutA((getX()+6)*escalaX,(getY()+29)*escalaY,"Tabela" +IntToStr(getIdentidade()));
		}
};
//------------------------------------------------------------------------------
void visualizadorTabela::interage()
{
	TfrmTabela *frmTabela = new TfrmTabela(Application, tblTabela);
	frmTabela->ShowModal();
	delete(frmTabela);
	frmTabela = NULL;
};
//------------------------------------------------------------------------------

